package com.lagou.client;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.net.Socket;

public class ClientInitClose {

    Socket s  = null;
    ObjectOutputStream oos = null;
    ObjectInputStream ois = null;

    public ObjectOutputStream getOos() {
        return oos;
    }

    public ObjectInputStream getOis() {
        return ois;
    }

    public void clientInit() throws IOException {
       s = new Socket(InetAddress.getLocalHost(), 8080);


       //创建输入输入流
        oos = new ObjectOutputStream(s.getOutputStream());
        ois = new ObjectInputStream(s.getInputStream());

        System.out.println("链接成功");

    }

    public void clientClose() throws IOException {
        oos.close();
        ois.close();
        s.close();
    }
}
